﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="form-view-with-ods.aspx.cs" Inherits="Dala.Samples.form_view.form_view_with_ods" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:FormView SkinID="FormView" ID="formView" runat="server" DataKeyNames="ProductId"
        DataSourceID="odsDetails">
        <EditItemTemplate>
            Name Name:
            <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("ProductName") %>' />
            <br />
            Item Number:
            <asp:TextBox ID="txtItemNumber" runat="server" Text='<%# Bind("ItemNumber") %>' />
            <br />
            Category Name:
            <asp:TextBox ID="txtCategoryName" runat="server" Text='<%# Bind("CategoryName") %>' />
            <br />
            Price:
            <asp:TextBox ID="txtPrice" runat="server" Text='<%# Bind("Price") %>' />
            <asp:LinkButton ID="btnSave" runat="server" Text="Save" OnClick="ButtonSave_Click"
                SkinID="LinkButton" />
        </EditItemTemplate>
        <InsertItemTemplate>
            Product Name:
            <asp:TextBox ID="txtProductName" runat="server" Text='<%# Bind("ProductName") %>' />
            <br />
            Item Number:
            <asp:TextBox ID="txtItemNumber" runat="server" Text='<%# Bind("ItemNumber") %>' />
            <br />
            Category Name:
            <asp:TextBox ID="txtCategoryName" runat="server" Text='<%# Bind("CategoryName") %>' />
            <br />
            Price:
            <asp:TextBox ID="txtPrice" runat="server" Text='<%# Bind("Price") %>' />
            <br />
            <asp:LinkButton ID="btnSave" runat="server" Text="Save" OnClick="ButtonSave_Click"
                SkinID="LinkButton" />
        </InsertItemTemplate>
        <ItemTemplate>
            Product Name:
            <asp:Literal ID="ltlProductName" runat="server" Text='<%# Bind("ProductName") %>'></asp:Literal>
            <br />
            Item Number:
            <asp:Literal ID="ltlItemNumber" runat="server" Text='<%# Bind("ItemNumber") %>'></asp:Literal>
            <br />
            Category Name:
            <asp:Literal ID="ltlCategoryName" runat="server" Text='<%# Bind("CategoryName") %>'></asp:Literal>
            <br />
            Price:
            <asp:Literal ID="ltlPrice" runat="server" Text='<%# Bind("Price") %>'></asp:Literal><br />
            <a href="<%# Page.GetRouteUrl(new {mode = "edit", id = Eval("ProductId")}) %>" class="button blue medium">
                Edit</a> <a href="<%= Page.GetRouteUrl("product-details", new {mode = "new", id = 0}) %>"
                    class="button blue medium">Add New</a>
        </ItemTemplate>
    </asp:FormView>
    <asp:ObjectDataSource ID="odsDetails" runat="server" DataObjectTypeName="Dala.Samples.DataAccessLayer.Product"
        DeleteMethod="DeleteProduct" InsertMethod="CreateNewProduct" OldValuesParameterFormatString="original_{0}"
        OnInserted="odsDetails_Inserted" OnSelecting="odsDetails_Selecting" SelectMethod="GetByProductId"
        TypeName="Dala.Samples.BusinessLogicLayer.ProductBLL" UpdateMethod="UpdateProduct">
        <SelectParameters>
            <asp:RouteParameter Name="_ProductId" RouteKey="id" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>
